import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class MyText extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Container(
          color: Colors.blue,
          margin: EdgeInsets.all(5),
          child: Text("普通Text组件"),
        ),
        Container(
          color: Colors.blue,
          margin: EdgeInsets.all(5),
          child: Text(
            "使用style的Text",
            style: TextStyle(
              color: Colors.yellow,
              fontSize: 30,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
        Container(
          color: Colors.blue,
          margin: EdgeInsets.all(5),
          child: Text(
            "textAlign对其方式",
            textAlign: TextAlign.center,
          ),
        ),
        Container(
          color: Colors.blue,
          margin: EdgeInsets.all(5),
          child: Text(
            "textDirection文本方向",
            textDirection: TextDirection.rtl,
          ),
        ),
        Container(
          color: Colors.blue,
          margin: EdgeInsets.all(5),
          child: Text(
            "softWrap自动换行softWrap自动换行softWrap自动换行softWrap自动换行",
            softWrap: true,
          ),
        ),
        Container(
          color: Colors.blue,
          margin: EdgeInsets.all(5),
          child: Text(
            "文本显示不下是采用的方法，[clip:直接裁剪; fade:越来越透明; ellipsis:省略号结尾; visible:依然显示，此时将会溢出父组件]",
            softWrap: false,
            overflow: TextOverflow.ellipsis,
          ),
        ),
        Container(
          color: Colors.blue,
          margin: EdgeInsets.all(5),
          child: Text(
            "1.5代表比原来的字体大50%",
            textScaleFactor: 1.5,
          ),
        ),
      ],
    );
  }
}
